package com.glela.platform.model.response;

import com.glela.platform.constant.ErrorEnum;

public class ResponseBaseModel {
	public int		code;
	public String	message;

	public static ResponseBaseModel response20000() {
		return new ResponseBaseModel(ErrorEnum.C20000);
	}

	public ResponseBaseModel(ErrorEnum error) {
		this.code = error.getCode();
		this.message = error.getMessage();
	}
	public ResponseBaseModel(){}
	public ResponseBaseModel(ErrorEnum error, String message) {
		this.code = error.getCode();
		this.message = message;
	}
	
	public ResponseBaseModel(int code,String message) {
		this.code = code;
		this.message = message;
	} 
	public String getMessage() {
		if (message == null) {
			message = "";
		}
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public void setError(ErrorEnum errorEnum) {
		if (errorEnum != null) {
			setCode(errorEnum.getCode());
			setMessage(errorEnum.getMessage());
		}
	}
}